/**
 * ProjectsAction.java
 *
 * Copyright (c) 2009 viorelt All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of viorelt .
 **/
package ro.prjmanager.web.actions;

import ro.prjmanager.core.annotations.Column;
import ro.prjmanager.core.annotations.EditOptions;
import ro.prjmanager.core.annotations.Id;
import ro.prjmanager.core.annotations.List;
import ro.prjmanager.model.Projects;
import ro.prjmanager.web.annotation.NomenclatorTarget;
import ro.prjmanager.web.annotation.Service;

@Service(target = "projectsService")
@NomenclatorTarget(addTarget = "add",deleteTarget = "del",editTarget = "edit",
        resource = "/pages/nomenclators/projects/projects.jsp",
        onFaildReturn = "/pages/nomenclators/projects/projects.jsp")
@List(serviceName = "projectsService",
        caption = "Project List",
        editUrl = "%context_path%/actions/Projects.action",
        id = "1", height = 200, rowNum = 10,
        url = "%context_path%/projects.lst")
public class ProjectsAction extends GenericAction<Projects> {

    @Id
    private Long idL;
    @Column(name = "name", caption = "Nume", index = "name", width = 150, editOptions = @EditOptions(pos = 1, required = true, prefix = "(*)"))
    private java.lang.String name;
    @Column(name = "description", caption = "Descriere", index = "description", width = 200, editOptions = @EditOptions(pos = 2, cols = 20, rows = 4, edittype = "textarea"))
    private java.lang.String description;
    @Column(name = "packageBase", caption = "Packetul de baza", index = "packageBase", width = 200, editOptions = @EditOptions(pos = 3, required = true, prefix = "(*)"))
    private java.lang.String packageBase;
    @Column(name = "companyName", caption = "Nume companie", index = "companyName", width = 200,
            editOptions = @EditOptions(pos = 4, cols = 20, rows = 4, edittype = "textarea"))
    private java.lang.String companyName;

    @Column(name = "shortName", caption = "Prescurtare", index = "shortName", width = 200,
            editOptions = @EditOptions(pos = 4, cols = 20, rows = 4, edittype = "text"))
    private java.lang.String shortName;




    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPackageBase() {
        return packageBase;
    }

    public void setPackageBase(String packageBase) {
        this.packageBase = packageBase;
    }
    public Long getIdL() {
        return idL;
    }

    public void setIdL(Long idL) {
        this.idL = idL;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public void add() {
        Projects prj=new Projects();
        prj.setName(getName());
        prj.setCompanyName(getCompanyName());
        prj.setPackageBase(getPackageBase());
        prj.setDescription(getDescription());
        prj.setShortName(getShortName());
        getService().create(prj);

    }
    public void edit() {
        Projects prj=getService().load(Integer.valueOf(getId()));
        prj.setName(getName());
        prj.setCompanyName(getCompanyName());
        prj.setPackageBase(getPackageBase());
        prj.setDescription(getDescription());
        prj.setShortName(getShortName());
        getService().update(prj);


    }



}
